CREATE TABLE [dbo].[GRN]
(
[GRNId] [nvarchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[GRNDate] [datetime] NOT NULL,
[POId] [nvarchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[SupplierID] [nvarchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[PreparedBy] [nvarchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[Amount] [decimal] (12, 0) NOT NULL,
[VAT] [decimal] (12, 0) NOT NULL,
[TotalAmount] [decimal] (12, 0) NOT NULL,
[ExchangeRate] [int] NULL,
[IsVoid] [bit] NOT NULL CONSTRAINT [DF_GRN_IsVoid] DEFAULT ((0)),
[Remark] [nvarchar] (250) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[IsComplete] [bit] NOT NULL CONSTRAINT [DF_GRN_IsComplete] DEFAULT ((0))
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[GRN] ADD CONSTRAINT [PK_GRN] PRIMARY KEY CLUSTERED  ([GRNId]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[GRN] ADD CONSTRAINT [FK_GRN_PO] FOREIGN KEY ([POId]) REFERENCES [dbo].[PO] ([POId])
GO
ALTER TABLE [dbo].[GRN] ADD CONSTRAINT [FK_GRN_WebUser] FOREIGN KEY ([PreparedBy]) REFERENCES [dbo].[WebUser] ([UserId])
GO
ALTER TABLE [dbo].[GRN] ADD CONSTRAINT [FK_GRN_Supplier] FOREIGN KEY ([SupplierID]) REFERENCES [dbo].[Supplier] ([SupplierId])
GO
